package com.zhala.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhala.common.annotation.Log;
import com.zhala.common.core.controller.BaseController;
import com.zhala.common.core.domain.AjaxResult;
import com.zhala.common.enums.BusinessType;
import com.zhala.system.domain.ZlSteelBigPipe;
import com.zhala.system.service.IZlSteelBigPipeService;
import com.zhala.common.utils.poi.ExcelUtil;
import com.zhala.common.core.page.TableDataInfo;

/**
 * 管接大组Controller
 * 
 * @author ruoyi
 * @date 2024-11-11
 */
@RestController
@RequestMapping("/system/big-pipe")
public class ZlSteelBigPipeController extends BaseController
{
    @Autowired
    private IZlSteelBigPipeService zlSteelBigPipeService;

    /**
     * 查询管接大组列表
     */
    @PreAuthorize("@ss.hasPermi('system:PIPE:list')")
    @GetMapping("/list")
    public TableDataInfo list(ZlSteelBigPipe zlSteelBigPipe)
    {
        startPage();
        List<ZlSteelBigPipe> list = zlSteelBigPipeService.selectZlSteelBigPipeList(zlSteelBigPipe);
        return getDataTable(list);
    }

    /**
     * 导出管接大组列表
     */
    @PreAuthorize("@ss.hasPermi('system:PIPE:export')")
    @Log(title = "管接大组", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ZlSteelBigPipe zlSteelBigPipe)
    {
        List<ZlSteelBigPipe> list = zlSteelBigPipeService.selectZlSteelBigPipeList(zlSteelBigPipe);
        ExcelUtil<ZlSteelBigPipe> util = new ExcelUtil<ZlSteelBigPipe>(ZlSteelBigPipe.class);
        util.exportExcel(response, list, "管接大组数据");
    }

    /**
     * 获取管接大组详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:PIPE:query')")
    @GetMapping(value = "/{CREATOR}")
    public AjaxResult getInfo(@PathVariable("CREATOR") String CREATOR)
    {
        return success(zlSteelBigPipeService.selectZlSteelBigPipeByCREATOR(CREATOR));
    }

    /**
     * 新增管接大组
     */
    @PreAuthorize("@ss.hasPermi('system:PIPE:add')")
    @Log(title = "管接大组", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ZlSteelBigPipe zlSteelBigPipe)
    {
        return toAjax(zlSteelBigPipeService.insertZlSteelBigPipe(zlSteelBigPipe));
    }

    /**
     * 修改管接大组
     */
    @PreAuthorize("@ss.hasPermi('system:PIPE:edit')")
    @Log(title = "管接大组", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ZlSteelBigPipe zlSteelBigPipe)
    {
        return toAjax(zlSteelBigPipeService.updateZlSteelBigPipe(zlSteelBigPipe));
    }

    /**
     * 删除管接大组
     */
    @PreAuthorize("@ss.hasPermi('system:PIPE:remove')")
    @Log(title = "管接大组", businessType = BusinessType.DELETE)
	@DeleteMapping("/{CREATORs}")
    public AjaxResult remove(@PathVariable String[] CREATORs)
    {
        return toAjax(zlSteelBigPipeService.deleteZlSteelBigPipeByCREATORs(CREATORs));
    }
}
